package com.yantong.constant;

import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;

/**
 * 订单状态
 * @author kanghaixin
 * @date 2018/9/10.10:24
 */
public enum OrderStatus {
    cancel(-1, "取消"),
    wait_pay(0, "待支付"),
    wait_send(1, "待发货"),//商城订单：待发货；外卖订单：待商家接单；预约订单：待使用；拼团订单：待分享；
    wait_received(2, "待收货"),//商城订单：待收货；待取餐
    delivery_success(3, "已收货"),//外卖订单：已送达；
    wait_refund(4, "待退款"),
    work_access(5, "售后中"),
    success(6, "已完成"),

    merchant_received(7, "商家已接单"),//外卖订单：商家已接单（用户），待下单（商家）
    merchant_place_order(8, "商家已下单"),//外卖订单：制作中（用户），商家已下单（商家）
    merchant_finish_order(9, "制作完成"),//外卖订单：待取餐（用户），制作完成（商家）

    goods_sending(10, "配送中")//商城订单：配送中；外卖订单：骑手配送中
    ;

    private int code;
    private String msg;

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }



    private static Map<Integer, String> all= new HashMap<>();
    static{
        for(OrderStatus orderStatus: EnumSet.allOf(OrderStatus.class)){
            all.put(orderStatus.code, orderStatus.msg);
        }
    }
    public static String get(Integer code){
        return all.get(code);
    }

    OrderStatus(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }
}
